#include <iostream>
#include <signal.h>

using namespace std;

volatile int flag = 0;

void handler(int signo)
{
    flag = 1;
    cout << "flag = " << flag << endl;  
}

int main()
{

    signal(2, handler);
    while(!flag);

    cout << "process exit " << endl;
    return 0;
}